<template>
    <div>
        <!--查询区域-->
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark"></div></el-col>
        </el-row>
        <!--列表区域-->
        <el-row>
            <div style="margin-bottom:3px">
                <el-button size="mini" type="primary">开始拆包</el-button>
            </div>
            <el-col :span="24">
                <!--装盘的工作包-->
                <el-table :data="unPackages.tableData" @selection-change="unpackHandleSelectionChange" height="350" row-key="id" border lazy :load="load" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                    <el-table-column  type="selection" width="55"></el-table-column>
                    <el-table-column  prop="packageCode" label="工作包编号" width="180" show-overflow-tooltip></el-table-column>
                    <el-table-column  prop="startPlaneNo" label="架次" width="60"></el-table-column>
                    <el-table-column  prop="aoCode" label="AO号" width="180" show-overflow-tooltip></el-table-column>
                    <el-table-column  prop="itemCode" label="图号" width="180" show-overflow-tooltip></el-table-column>
                    <el-table-column  prop="packageCount" label="分拣数量"></el-table-column>
                    <el-table-column  prop="itemQty" label="需求数量"></el-table-column>
                    <el-table-column  prop="palletCode" label="托盘号"></el-table-column>
                    <el-table-column  prop="sortingStatus" label="分拣状态"  show-overflow-tooltip></el-table-column>
                </el-table>
                <el-pagination @size-change="unpackHandleSizeChange" @current-change="unpackHandleCurrentChange" :current-page.sync="unPackages.page.currentPage" 
                    :page-sizes="[10,50,100, 200, 300, 400]" :page-size="unPackages.page.pageSize" layout="total,sizes, prev, pager, next" :total="unPackages.page.total">
                </el-pagination>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import request from '@/utils/request.js';
export default {
    name:"",
    data(){
        return {
            unPackages:{
                tableData:[],
                page:{
                    currentPage:1,
                    pageSize:20,
                    total:0
                },
                selectData:[]
            }
            
        }
    },
    methods:{
        load(tree, treeNode, resolve){
            console.log("tree",tree);
            console.log("treeNode",treeNode);
            if(tree.treeType=="package"){
                request.post("/packageUnpackRest/queryAoByPackage",{"msTaskPackageId":tree.msTaskPackageId}).then((res)=>{
                    console.log("res",res)
                    resolve(res.data);
                })
            }else{
                resolve(tree.children);
            }
            //queryAoByPackage
           // resolve(tree.children);
            console.log(resolve);
        },
        queryUnpackPackage(){//查询缺包的工作包
            var that = this;
            request.post("/packageUnpackRest/queryPackageTask",{"page":this.unPackages.page,"searchParams":{}}).then((res)=>{
                console.log("res.data.retData",res);
                this.unPackages.tableData = res.data.list;
                this.unPackages.page.total = res.data.total;
            });
        },
        unpackHandleSelectionChange(val){
            this.unPackages.selectData = val;
            console.log("selectData",this.unPackages.selectData);
        },
        unpackHandleSizeChange(val){
            this.unPackages.page.pageSize = val;
        },
        unpackHandleCurrentChange(val){
            this.unPackages.page.currentPage = val;
        }
    },
    mounted(){
     //   this.$options.methods.queryUnpackPackage.bind(this)();
    }
}
</script>